<template>
  <div class="box">
    <div class="manualOrderList" v-for="(item, ind) in listInfo" :key="ind">
      <div class="list_t flex-j-sb">
        <div class="list_t_l">订单号: {{ item.order_sn }}</div>
        <div class="list_t_r">{{ item.status_name }}</div>
      </div>
      <div class="list_good flex" v-for="(child, index) in item.orderGoods" :key="index">
        <div class="list_good_l">
          <img :src="child.has_goods.thumb" v-if="child.has_goods" alt="" />
        </div>
        <div class="list_good_r">
          <div class="list_good_r_top">
            <div class="list_good_r_title" v-if="child.has_goods">{{ child.has_goods.title }}</div>
            <div class="list_good_r_total" v-if="child.has_goods_option">规格:{{ child.has_goods_option.title }}</div>
            <div class="list_good_r_total">X{{ child.total }}</div>
          </div>
          <div class="list_good_r_parice">￥{{ child.price }}</div>
        </div>
      </div>
      <div class="remark">{{ item.realname }}({{ item.mobile }})</div>
      <div class="orderDetail">
        共{{ item.order_goods_total }}件商品 <span v-if="item.is_prepay">定金:￥{{ item.prepay_price }}</span> 总价:￥{{ item.price }} <span class="realCharge">应收:￥{{ item.pay_price }}</span>
      </div>
      <div class="optionBox">
        <div @click="processor(btn)" :class="[btn.name == '通过' ? 'btn redB' : 'btn bd']" v-for="(btn, indx) in item.button_models" :key="indx">{{ btn.name }}</div>
      </div>
      <textAreaPopup :popupObj="popupObj" v-model="show" @childPost="childPost" @subPost="subPost"></textAreaPopup>
    </div>
  </div>
</template>
<script>
import textAreaPopup from "./textAreaPopup.vue";
export default {
  props: {
    listInfo: {
      type: null
    }
  },
  data() {
    return {
      show: false,
      popupObj: {
        title: "",
        api: "",
        params: {}
      }
    };
  },
  components: {
    textAreaPopup
  },
  methods: {
    processor(btn) {
      console.log(btn, "btn");
      if (!btn.api) {
        this.$router.push(this.fun.getUrl("manualOrderDetail", { manual_order_id: btn.params.manual_order_id }));
        return;
      }
      this.show = true;
      if(btn.name == '通过' || btn.name == '驳回'){
        this.popupObj.title = `审核${btn.name}备注`;
      }else{
        this.popupObj.title = `${btn.name}备注`;
      }
      this.popupObj.api = btn.api;
      if (btn.params) {
        this.popupObj.params = btn.params;
      }
    },
    childPost(e) {
      this.show = e;
      this.popupObj.title = "";
      this.popupObj.api = "";
      this.popupObj.params = {};
    },
    subPost(e) {
      this.childPost(e);
      this.$emit("resetGetData");
    }
  }
};
</script>
<style lang="scss" scoped>
.manualOrderList {
  padding: 0.91rem 0.75rem 0.94rem 0.75rem;
  box-sizing: border-box;
  background: #fff;
  border-radius: 0.5rem;
}
.list_t {
  margin-bottom: 0.69rem;
  .list_t_l {
    font-size: 0.81rem;
    color: #454545;
  }
  .list_t_r {
    font-size: 0.81rem;
    color: #f15353;
  }
}
.list_good {
  padding: 0.69rem 0 0.75rem 0;
  .list_good_l {
    width: 5.81rem;
    height: 5.81rem;
    border-radius: 0.5rem;
    margin-right: 0.66rem;
    flex-shrink: 0;
    img {
      width: 100%;
      height: 100%;
      border-radius: 0.5rem;
    }
  }
  .list_good_r {
    padding: 0.5rem 0 0.63rem 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .list_good_r_top {
      text-align: left;
      font-size: 0.94rem;
      .list_good_r_title {
        font-weight: 500;
        margin-bottom: 0.3rem;
      }
      .list_good_r_total {
        font-size: 0.81rem;
      }
    }
    .list_good_r_parice {
      text-align: left;
      font-size: 0.81rem;
    }
  }
}
.remark {
  font-size: 0.81rem;
  color: #909090;
  text-align: left;
}
.orderDetail {
  padding-top: 1.44rem;
  padding-bottom: 0.97rem;
  text-align: right;
  font-size: 0.81rem;
  .realCharge {
    color: #f15353;
  }
}
.optionBox {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  .btn {
    padding: 0.47rem 1.72rem;
    font-size: 0.81rem;
    line-height: 0.81rem;
    margin-left: 0.75rem;
    border-radius: 0.88rem;
    flex-shrink: 0;
    &.redB {
      background: #f15353;
      color: #fff;
    }
    &.bd {
      border: 1px solid #000000;
    }
  }
}
</style>
